<template>
  <div class="app-container">
    <el-table :data="list" border stripe>
      <el-table-column type="index" width="50"></el-table-column>
      <el-table-column prop="borrowAmount" label="借款额度"></el-table-column>
      <el-table-column
        prop="integralStart"
        label="积分区间开始"
      ></el-table-column>
      <el-table-column
        prop="integralEnd"
        label="积分区间结束"
      ></el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-popconfirm
            title="确定删除吗"
            @onConfirm="removeById(scope.row.id)"
          >
            <el-button slot="reference">删除</el-button>
          </el-popconfirm>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import integralGradeApi from '@/api/core/integral-grade'

export default {
  data() {
    return {
      list: []
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    test() {
      console.log(123)
    },
    fetchData() {
      integralGradeApi.list().then(respose => {
        this.list = respose.data.list
      })
    },
    removeById(id) {
      integralGradeApi.removeById(id).then(response => {
        this.$message({
          showClose: true,
          message: response.message,
          type: 'success'
        })
        this.fetchData()
      })
    }
  }
}
</script>

<style scoped></style>
